<div class="SipeiInfo border_3 pt20 pb20 centered back_bgf"> 
	<?php
		$form = $this->beginWidget('CActiveForm', array(
			'action' => Yii::app()->createUrl($this->route),
			'method' => 'POST',
			'id' => 'searchForm',
		 'htmlOptions'=>array('target'=>'ajax-frame')
		));
	?>
    <table class="fontc_666 height32">
        <tbody>
            <tr height="55">
                <td valign="top" width="125" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>科别代码：</td>
                <td valign="top" width="370" class="formValidator_td">
                    <input type="text" name="info[disciplin_code]" id='disciplin_code' value="" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666" />
                    <div class="formValidator_tip">
                        <p id="disciplin_codeTip" ></p>
                    </div>
                </td>
            </tr>
            <tr height="55">
                <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>上报简称：</td>
                <td valign="top" class="formValidator_td">
                    <input type="text" name="info[disciplin_nick]" id='disciplin_nick' value="" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666" />
                    <div class="formValidator_tip">
                        <p id="disciplin_nickTip" ></p>
                    </div>
                </td>
            </tr>
            <tr height="55">
                <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>科别名称：</td>
                <td valign="top" class="formValidator_td">
                    <input type="text" name="info[disciplin_name]" id='disciplin_name' value="" class="col3 pt5 pr10 pb5 pl10 height20 border_c border_3 fontc_666" />
                    <div class="formValidator_tip">
                        <p id="disciplin_nameTip" ></p>
                    </div>
                </td>
            </tr>
            <tr>
                <td valign="top" align="right" class="pr5"><span class="pr5 fontc_orange_red">*</span>所属类别：</td>
                <td valign="top">
                    <span class="fl standard_select pt5 pr7 pb5 pl3 border_c border_3">
                        <span class="fl select_shelter">
                            <select class="fl fontc_666" name="info[disciplin_type]">
                                <option value="1">理科</option>
                                <option value="2">文科</option>
                                <option value="3">艺体</option>
                            </select>
                        </span>
                    </span>
                </td>
            </tr>
            <tr>
                <td align="right" class="pt16 pr5">是否生效：</td>
                <td class="pt16"><input type="checkbox" name="info[disabled]" value="1" checked /></td>
            </tr>
            <tr>
                <td valign="top" align="right" class="pt10 pr5 pb5">包含科目：</td>
                <td valign="top" class="pt10 pb5 formValidator_td height20">
                    <ul class="OutList" id="checkBoxs"> 
                    <?php if (!empty($subject)): ?>
                        <?php foreach ($subject as $sv): ?>
                        <li class="fl pt8 pr12">
                            <input type="checkbox" value="<?php echo $sv['subject_id']; ?>" name="check[]" class="fl checkbox" />
                            <span class="fl pl5"><?php echo $sv['subject_name']; ?></span>
                        </li>
                        <?php endforeach; ?>
                    <?php endif; ?>
                    </ul>
                    <div class="formValidator_tip">
                        <p id="test2Tip" ></p>
                    </div>
                </td>
            </tr>
            <tr>
                <td valign="top" align="right" valign="top" class="pt20 pr5">备注：</td>
                <td valign="top" class="pt20"><textarea name="info[description]" class="col3 pt6 pr10 pb6 pl10 border_c border_3 fontc_666"></textarea></td>
            </tr>
            <tr>
                <td colspan="2" align="center" class="pt20 pb20">
                    <input type="submit" name="submit" onclick="return submitCheck()" value="保存" class="b_a_n border_3 back_bgfb w80 height32 fontc_FFF fonts_12 cursor mr10" />
                    <input type="button" value="取消" onclick="api.close()" class="b_a_n border_3 back_bgb w80 height32 fontc_FFF fonts_12 cursor" />
                </td>
            </tr>
        </tbody>
    </table>
	<?php
		$this->endWidget();
	?>
</div>

<iframe src='' style="display:none" name='ajax-frame'></iframe>
<script>
function submitCheck(){
	if($.trim($("#checkBoxs").html()) == ''){
		$("#test2Tip").html('<p class="noticeWrap"><b class="ico-warning"></b><span class="txt-err">请更新科目信息</span></p>');
		return false;
	}
	
}

$(function(){
	$.formValidator.initConfig({formID:"searchForm",theme:"126",submitOnce:false,
        onError:function(msg,obj,errorlist){
                $("#errorlist").empty();
                $.map(errorlist,function(msg){
                        $("#errorlist").append("<li>" + msg + "</li>")
                });
                alert(msg);
        },
        ajaxPrompt : '有数据正在异步验证，请稍等...'
	});
	
	/*科别代码验证*/
	$("#disciplin_code").formValidator({
		onShowText:"请输入科别代码",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
        min:1,
        max:20,
        onError:"科别代码长度在1-20之间"
	}).regexValidator({
		regExp:"^[a-zA-Z]{1,}([0-9]|[a-zA-Z])+$",
		onError:"科别代码格式不正确"
	});


	/*上报简称验证*/
	$("#disciplin_nick").formValidator({
		onShowText:"请输入上报简称",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		max:20,
		onError:"上报简称长度在1-20之间(1到10个汉字)"
	});
        
        /*科别名称验证*/
	$("#disciplin_name").formValidator({
		onShowText:"请输入科别名称",
		onShow:"",
		onFocus:"",
		onCorrect:"输入正确",
		leftTrim:true,
		rightTrim:true
	}).inputValidator({
		min:1,
		max:20,
		onError:"科别名称长度在1-20之间(1到10个汉字)"
	});
	
	/*$(":checkbox[name='check[]']").formValidator({
		tipID:"test2Tip",
		onShow:"",
		onFocus:"至少选择1个",
		onCorrect:"选择正确"
	}).inputValidator({
		min:0,
		onError:"至少选择1个"
	});*/
	

})
</script>
<?php exit; ?>